home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1989 February / Ahoy_Magazine_89-02_1989_Double_L.d64 / Charitable Task (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  632b  |  16 lines

  1. 0 print"[147]"tab(12)"charitable task"
  2. 1 rem ==================================
  3. 2 rem    commodares problem #58-3 :
  4. 3 rem       charitable task
  5. 4 rem    solution by
  6. 5 rem       keith kushner
  7. 6 rem ==================================
  8. 10 zz=rnd(-ti):d=3e3:fort=0to8:a(t)=int(rnd(1)*900+100):next
  9. 20 foru=1to7:forv=u+1to8:fort=0to8:b(t)=a(t):next
  10. 30 b(u)=a(1):b(v)=a(2+(u=2)):b(1)=a(u):b(2)=a(v):gosub80:gosub50:gosub40:next:next:end
  11. 40 forx=3to5:fory=6to8:gosub80:c(x)=b(y):c(y)=b(x):gosub50:next:next:return
  12. 50 h=0:l=3e3:fort=0to2:s(t)=c(3*t)+c(3*t+1)+c(3*t+2)
  13. 60 h=h-(s(t)-h)*(s(t)>h):l=l+(l-s(t))*(s(t)<l):next:on-(h-l<d)gosub70:return
  14. 70 d=h-l:fort=0to2:forw=0to2:printc(w+3*t);:next:print"=";s(t):next:printd:return
  15. 80 fort=0to8:c(t)=b(t):nextt:return
  16.